李守中

FreeBSD 基础使用

Table of Contents

1. pkg 包管理器更换中科大镜像源

FreeBSD pkg 包管理器的配置文件 /etc/pkg/FreeBSD.conf 是 FreeBSD 基本系统的一部分,会随着 freebsd-update 更新,不要直接修改,要创建 /usr/local/etc/pkg/repos/FreeBSD.conf 覆盖配置,内容为:

FreeBSD: {
  url: "pkg+http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/quarterly",
}

如果要使用滚动更新的 latest 仓库,把 url 配置最后的 quarterly 换成 latest 即可。

修改配置后,运行 pkg update -f 更新索引。

使用 HTTPS 可以有效避免国内运营商的缓存劫持,但需要事先安装 security/ca_root_nss 软件包。

2. 虚拟机内使用 FreeBSD

VMware 系的虚拟化软件需要 pkg install open-vm-tools-nox11 带图形界面的话 pkg install open-vm-tools 。然后在 /etc/rc.conf 中添加:

vmware_guestd_enable="YES"

3. 获取 CPU 温度

Intel CPU 需要加载内核模块 sudo kldload -v amdtemp ,AMD CPU 需要加载内核模块 sudo kldload -v coretemp

执行 sysctl -a | grep temperature 或者 sysctl dev.cpu | grep temperature 可以获取到每个 CPU 核心的温度。

要让对应模块开机自动加载,需要在 /etc/rc.conf 中写明加载项 (按需取消注释):

# get CPU temperature
#coretemp_load="YES" # for Intel CPU
#amdtemp_load="YES" # for AMD CPU


Last Update: 2023-07-19 Wed 08:42

Generated by: Emacs 28.2 (Org mode 9.5.5)   Contact: [email protected]

若正文中无特殊说明,本站内容遵循: 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议